<?php
/**
 * Gamux.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @todo document
 * @file
 * @ingroup Skins
 */
if ( !defined( 'MEDIAWIKI' ) ) {
	die( -1 );
} 

class SkinGamux extends SkinTemplate {
	var $skinname = 'gamux', $stylename = 'Gamux',
	    $template = 'GamuxTemplate', $useHeadElement = true;

	public function initPage( OutputPage $out ) {
		global $wgLocalStylePath;

		parent::initPage( $out );
		$min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '' : '.min';
	}
		
	function setupSkinUserCss( OutputPage $out ) {
		parent::setupSkinUserCss( $out );
		$out->addModuleStyles( array(
			'mediawiki.skinning.interface',
			'skins.gamux.styles'
		) );		
	}
}

class GamuxTemplate extends BaseTemplate {
	/**
	 * Outputs the entire contents of the page
	 */
	public function execute() {
		wfSuppressWarnings();
		$this->html( 'headelement' ); 
?>
<div class="body">
<!-- 头部 -->
<header class="am-topbar am-g am-topbar-inverse">
  <div class="topbar-inner am-u-sm-11 am-u-md-11 am-u-lg-10">
    <div class="am-topbar-brand topbar-brand topbar-logo am-u-lg-2 am-u-md-2 am-u-sm-4">
    <!--以下函数调用网站的名字,链接是首页地址-->
	  <a href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ); ?>">
	  <?php $this->text( 'sitename' ); ?>
	  </a>
	</div>	
    <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#doc-topbar-collapse'}">
	  <span class="am-sr-only">导航切换</span> 
	  <span class="am-icon-bars"></span>
	</button>
	<div class="am-collapse am-topbar-collapse" id="doc-topbar-collapse">
	  <ul class="am-nav am-nav-pills am-topbar-nav topbar-nav">
	    <li id="homepage" class="<?php if($this->data["title"] == "首页"){echo "am-active";} ?>"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ); ?>">首页</a></li>
		<li id="specialpage"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['specialpages']['href']); ?>">特殊页面</a></li>
	    <li class="am-dropdown" data-am-dropdown>
		  <a class="am-dropdown-toggle" data-am-dropdown-toggle href="javascript:;">
		    关于本站 <span class="am-icon-caret-down"></span>
		  </a>
		  <ul class="am-dropdown-content">
		    <li class="am-dropdown-header">现任站长：Saro</li>
		    <li><a href="#">本站介绍</a></li>
		    <li class="am-active"><a href="#">免责声明</a></li>
		    <li><a href="#">团队人员</a></li>
		    <li class="am-divider"></li>
		    <li><a href="#">联系我们</a></li>
		  </ul>
	    </li>
	  </ul>
	  <form class="am-topbar-form am-topbar-left am-form-inline top-search" role="search" method="get" action="<?php echo $this->data['searchaction']; ?>">
	    <div class="am-input-group">
		  <span class="am-input-group-btn">
			<span class="am-btn am-btn-secondary top-btn" type="button"><a href="<?php echo htmlspecialchars( $this->data['sidebar']['navigation'][2]['href'] ); ?>" target="_blank">随机</a>
			</span>
		  </span>
		  <input type="hidden" value="special:search" name="title">
		  <input type="hidden" value="default" name="profile">
		  <input type="hidden" value="Search" name="fulltext">
		  <input type="search" class="am-form-field am-input-sm top-inputbox" placeholder="搜索" name="search">
	    </div>
	  </form>
	  <div class="am-topbar-right">
	    <div class="am-dropdown" data-am-dropdown="{boundary: '.am-topbar'}">
		  <button class="am-btn am-btn-secondary am-topbar-btn am-btn-sm am-dropdown-toggle" data-am-dropdown-toggle>其他 <span class="am-icon-caret-down"></span></button>
		  <ul class="am-dropdown-content">
		    <?php if(!$this->data["loggedin"]) { ?>
		    <li><a href="<?php echo $this->getPersonalTools()['createaccount']['links'][0]['href'] ?>">注册</a></li>			
		    <li><a href="<?php echo SpecialPage::getTitleFor( 'passwordreset' )->getFullURL(); ?>">找回密码</a></li>
			<?php }else{ ?>			
			<li><a href="<?php echo $this->getPersonalTools()["preferences"]["links"]["0"]["href"]; ?>">用户中心</a></li>
			<?php } ?>
		  </ul>
	    </div>
	  </div>
	  <div class="am-topbar-right">
	    <span class="am-btn am-btn-primary am-topbar-btn am-btn-sm">
		  <a href="
		  <?php if($this->data["loggedin"]) { ?>
		    <?php echo $this->getPersonalTools()["logout"]["links"][0]["href"]; ?>
			">退出
		  <?php }else { ?>
		    <?php echo $this->getPersonalTools()['login']['links'][0]['href'] ?>
			">登录
		  <?php } ?>
		  </a>
		</span>
	  </div>
	</div>
  </div>
</header>

<!-- 主要部分 -->
<div class="section">
<div class="am-g main">
  <div class="am-u-sm-11 am-u-md-11 am-u-lg-10 main-inner">
    <div class="breadcrumb">
	  <ol class="am-breadcrumb am-breadcrumb-slash">
	    <li><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ); ?>" class="am-icon-home">首页</a></li>
	    <li><?php $this->html( 'title' ); ?></li>
	  </ol>
	  <div class="textactions">
	  <?php $nav = $this->data['content_navigation'];
		//文章编辑框
		foreach($nav as $key => $value){
		  foreach($value as $ke => $val){
			echo "<span class='am-badge am-badge-primary'><a href='".$val["href"]."'>".$val["text"]."</a></span>";
		  }}?>		
	  </div>
	</div>
	<hr data-am-widget="divider" style="" class="am-divider am-divider-dashed" />
	<?php
	if ( $this->data['sitenotice'] ) { ?>
		<div id="siteNotice"><?php $this->html( 'sitenotice' ); ?></div>
	<?php } ?>
	<div class="bodytext">
	  <?php $this->html( 'bodytext' ); ?>
	  <?php
		if ( $this->data['dataAfterContent'] && $this->data['sidebar']['navigation'][0]['text']!=$this->data['thispage']) {
			$this->html( 'dataAfterContent' );
		}
	  ?>
	  <div class="textmeta">
	    <?php if($this->data['isarticle']){ ?>
	      <blockquote><?php echo $this->data["lastmod"]; ?></blockquote>
		<?php } ?>
	  </div>
	</div>
  </div>
</div>
<hr data-am-widget="divider" style="" class="am-divider am-divider-default bottom-divider" />
<!-- 底部 -->
<footer data-am-widget="footer" class="am-g am-footer" data-am-footer="{  }">
  <div class="am-u-sm-11 am-u-md-11 am-u-lg-10 footer-inner">
  <div class="footer-inner-left am-u-sm-11 am-u-md-11 am-u-lg-10">  
    <div class="am-footer-switch">
      <span class="am-footer-ysp" data-rel="mobile"
          data-am-modal="{target: '#am-switch-mode'}">
          手机版(暂未推出)
      </span>
      <span class="am-footer-divider"> | </span>
      <a id="godesktop" data-rel="desktop" class="am-footer-desktop" href="javascript:">
          电脑版
      </a>
<!--
      <span class="am-footer-divider"> | </span>
      <span class="am-footer-ysp" data-rel="mobile"
          data-am-modal="{target: '#am-switch-mode'}">
          命令行版(暂未推出)
      </span>
-->
    </div>
	<div>
	  <?php echo "我的中国梦 · 简洁 · 现代 · 自由 / 为Linux用户的娱乐性而奋斗！"; ?>
	</div>	
    <div class="footer-copyright">
	  <?php echo $this->data["copyright"]; ?>	  
	</div>
    <div class="am-footer-miscs ">
	  <div>Powered by Mediawiki and theme designed by 小鸡. </div>
      <div>CopyRight©2012-<?php echo date("Y"); ?>  gamux.org.</div>
	</div>
  </div>  
  <div class="am-u-lg-2">
	<div class="copyrightico"><a href="https://www.mediawiki.org/wiki/MediaWiki/zh-hans" target="_blank"><img src="https://www.mediawiki.org/static/1.27.0-wmf.7/resources/assets/poweredby_mediawiki_88x31.png" /></a></div>
	<div class="poweredbyico"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" /></a></div>
<!--
	<div class="footer-qq"><button type="button" class="am-btn am-btn-primary">Q群274328087</button></div>
-->
  </div>
  <div class="clearboth"></div>
  </div>
</footer>
<!--footer end-->
</div>
  <div data-am-widget="gotop" class="am-gotop am-gotop-fixed" >
    <a href="#top" title="回到顶部">
        <span class="am-gotop-title">回到顶部</span>
          <i class="am-gotop-icon am-icon-chevron-up"></i>
    </a>
  </div>
</div>
<link rel="stylesheet" href="<?php echo $IP; ?>/skins/Gamux/css/main.css">
<link rel="stylesheet" href="http://cdn.amazeui.org/amazeui/2.4.2/css/amazeui.min.css">
<script src="http://cdn.amazeui.org/amazeui/2.4.2/js/amazeui.min.js"></script>
<script src="<?php echo $IP; ?>/skins/Gamux/resources/gamux.js"></script>
<?php if(!$this->data["isarticle"]) { ?>
<link rel="stylesheet" href="<?php echo $IP; ?>/skins/Gamux/css/specialpages.css">
<script src="<?php echo $IP; ?>/skins/Gamux/resources/specialpages.js"></script>
<?php } ?>
<?php $this->printTrail(); ?>	
</body>
</html><?php
	}
}